home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- * Copyright © 1992-1993 Mark Pilgrim *
- * *
- * This file is provided as is, and may be freely distributed unaltered. This *
- * message must accompany any copy of this file. This file may be used or *
- * modified for use for a non-commercial product provided that appropriate *
- * credit is given to the author named above. *
- * Commercial use of this source code is prohibited. *
- ******************************************************************************/
-
- #include "msg misc.h"
- #include "msg timing.h"
-
- #define gap 4 /* difference between one radius and the next */
- #define CorrectTime 2
-
- void CircleOut(GrafPtr);
-
- /* Make a circular region and use it as the mask in CopyBits. Lots of overlap,
- but masked by timing correction. If you want to optimize it, look at the
- donut region code in "Circle in.c" */
-
- void CircleOut(GrafPtr sourceGrafPtr)
- {
- Rect theRect;
- int cx, cy;
- RgnHandle curregion;
-
- cx = MAIN_WINDOW_WIDTH / 2;
- cy = MAIN_WINDOW_HEIGHT / 2;
-
- theRect.left=cx-gap; /* circumscribing rectangle for circle */
- theRect.right=cx+gap;
- theRect.top=cy-gap;
- theRect.bottom=cy+gap;
-
- curregion=NewRgn();
-
- do
- {
- StartTiming();
- SetEmptyRgn(curregion);
- OpenRgn();
- FrameOval(&theRect); /* the circle region */
- CloseRgn(curregion);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &theRect, &theRect, 0, curregion);
- theRect.left-=gap; /* make the rect bigger (and thus the circle) */
- theRect.right+=gap;
- theRect.top-=gap;
- theRect.bottom+=gap;
- TimeCorrection(CorrectTime);
- }
- while (theRect.right-theRect.left<=592); /* (2 x || (cx,cy) ||) + a little */
-
- DisposeRgn(curregion);
- }
-